# Contributor: Dermot Bradley <dermot_bradley@yahoo.com>
# Contributor: Tycho Andersen <tycho@docker.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=audit
pkgver=3.1.2
pkgrel=1
pkgdesc="User space tools for kernel auditing"
url="https://people.redhat.com/sgrubb/audit/"
arch="all"
license="LGPL-2.1-or-later"
depends_dev="linux-headers"
makedepends="$depends_dev swig libcap-ng-dev python3"
install="$pkgname.pre-install"
subpackages="
	$pkgname-static
	$pkgname-dev
	$pkgname-doc
	$pkgname-libs
	$pkgname-openrc
	"
source="https://people.redhat.com/sgrubb/audit/audit-$pkgver.tar.gz
	0003-all-get-rid-of-strndupa.patch
	usr-paths.patch
	musl.patch
	auditd.initd
	auditd.confd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-zos-remote \
		--enable-shared=audit \
		--with-arm \
		--with-aarch64
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/auditd.initd "$pkgdir"/etc/init.d/auditd
	install -Dm644 "$srcdir"/auditd.confd "$pkgdir"/etc/conf.d/auditd
}

static() {
	pkgdesc="Static libaudit libraries"

	amove usr/lib/*.a
}

sha512sums="
a97003a294ed3671df01e2952688e7d5eef59a35f6891feb53e67c4c7eab9ae8c2d18de41a5b5b20e0ad7156fac93aec05f32f6bc5eea706b42b6f27f676446a  audit-3.1.2.tar.gz
f3f2c4ee745e99877c981d889c5cbb0379d073a9b7634c1480ae603a21a13045f9978b51f8cb53c8d0ba414d249bb859af7bca7e302c464b3fc3c6463ecca762  0003-all-get-rid-of-strndupa.patch
90c7d213a0b4ef27bf643e046dd2b3c5909706c62fba24ef34ecb32ff07b73fda13ed04c616a7cf8148115fc977aa1096b61e717abd5bd32f72f7bb4ac07999f  usr-paths.patch
a347c45cb1cd3c93ece5352218f1e7bc38938f3cbaf060158e4df40e9f027afbc3c6a3651f25e26e45ab9f2c96af2181d2638b09ed747a4348d0fc88af798798  musl.patch
b3d7ceba02b6b4406222c3b142fcfdf2b612dc52eebc490cfd121d696e4ef7c6cc5e27813d67937c464ed4c3cd283de9ccfcb75e63405a447523fa4641e79da3  auditd.initd
69d8777772ded7a8c0db2bcf84961b121bb355fa0d4ba0e14e311f8a8bfe665cbd2b7ac632d73477f9dfa9a6eec357a7ed458fe9b3e7b5ede75b166f3f092ab7  auditd.confd
"
